#include "CCompiler.h"
#include <iostream>
extern int yylineno;
int main(int argc, char *argv[])
{
	CCompiler *pCC;
	try{
		if(argc==3) 
			pCC = new CCompiler(argv[1], argv[2]);
		else {
			std::cout << "using ./ccompiler src.c dest.out" <<std::endl;
			std::cout << "Now give a example: ./ccompiler cc.txt cc.out" << std::endl;
			pCC = new CCompiler("cc.txt", "cc.out");
		}
		pCC->compile();
		std::cout << "Now you can get Symbol Table in SymbolTable.out"<<std::endl;
	}catch(const char *msg) {
		std::cout << "catch : " << yylineno <<"  "<< msg << std::endl;
	}catch(const std::string &msg) {
		std::cout << "catch : " << yylineno <<" "<< msg << std::endl;
	}catch(...){
		std::cout << "unknow err occurd" << std::endl;
	}
	delete pCC;
	return 0;
}
